package com.numbfish.ch00_ex00_template;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;

@SpringBootTest
@Slf4j

public class Ch00Ex00TemplateTestApp {
    @Autowired
    private  ApplicationContext applicationContext;




    @Test
    void contextLoads() {
        log.info("applicationContext = {}",applicationContext);
    }
    @Test
    void beanCount(){
        // 用户未定义任何类时的bean个数为 springBoot2.7 : 139
        // 用户未定义任何类时的bean个数为 springBoot3   : 152
        log.info("applicationContext default bean count= {}",applicationContext.getBeanDefinitionNames().length);
    }


    void outputTheBeanFromContext(Class<?> clazz){
        // 用户未定义任何类时的bean个数为152
        log.info("applicationContext get a bean  {} === {}",clazz,applicationContext.getBean(clazz));
    }


}